﻿// MT526




using Little.Soldier.SWIFT;
using Little.Soldier.SWIFT.Definition;
using System.Collections.Generic;
using System.ComponentModel;

namespace Little.Soldier.SWIFT.Messages.Category5
{
  public class MT526 : SwiftMessage
  {
    private static SwiftMessageDefinition MessageDefinition;
    private static SwiftTagSequenceDefinition U0002;
    private static SwiftTagDefinition U0003;
    private static SwiftTagSubItemDefinition U0004;
    private static SwiftTagDefinition U0005;
    private static SwiftTagSubItemDefinition U0006;
    private static SwiftTagDefinition U0007;
    private static SwiftTagSubItemDefinition U0008;
    private static SwiftTagSubItemDefinition U000E;
    private static SwiftTagDefinition U000F;
    private static SwiftTagSubItemDefinition U0010;
    private static SwiftTagDefinition U0011;
    private static SwiftTagDefinition U0012;
    private static SwiftTagSequenceDefinition U0013;
    private static SwiftTagDefinition U0014;
    private static SwiftTagSubItemDefinition U0015;
    private static SwiftTagSubItemDefinition U0016;
    private static SwiftTagSubItemDefinition U0017;
    private static SwiftTagDefinition U0018;
    private static SwiftTagSubItemDefinition U0019;
    private static SwiftTagSubItemDefinition U001A;
    private static SwiftTagDefinition U001B;
    private static SwiftTagSubItemDefinition U001C;
    private static SwiftTagDefinition U001D;
    private static SwiftTagSubItemDefinition U001E;
    private static SwiftTagSubItemDefinition U001F;
    private static SwiftTagSubItemDefinition U007F;
    private static SwiftTagSubItemDefinition U0080;
    private static SwiftTagChoiceDefinition U0081;
    private static SwiftTagDefinition U0082;
    private static SwiftTagSubItemDefinition U0083;
    private static SwiftTagSubItemDefinition U0084;
    private static SwiftTagDefinition U0086;
    private static SwiftTagSubItemDefinition U0087;
    private static SwiftTagSubItemDefinition U0088;
    private static SwiftTagDefinition U0089;

    [Description("Sequence A")]
    public MT526.SequenceAClass SequenceA
    {
      get
      {
        return new MT526.SequenceAClass((SwiftElement) this, 0, false);
      }
    }

    [Description("Sequence B")]
    public MT526.SequenceBClass[] SequenceB
    {
      get
      {
        int index = -1;
        List<MT526.SequenceBClass> list = new List<MT526.SequenceBClass>();
        int count;
        do
        {
          ++index;
          MT526.SequenceBClass sequenceBclass = new MT526.SequenceBClass((SwiftElement) this, index, false);
          count = this.ListTags((SwiftElement) sequenceBclass).Count;
          if (count > 0)
            list.Add(sequenceBclass);
        }
        while (count > 0);
        return list.ToArray();
      }
    }

    public MT526()
      : base(true)
    {
    }

    public MT526(SwiftMessage message)
      : base(message)
    {
    }

    public MT526.SequenceBClass AddSequenceB()
    {
      return new MT526.SequenceBClass((SwiftElement) this, this.SequenceB.Length, true);
    }

    public void RemoveSequenceB(MT526.SequenceBClass sequence)
    {
      foreach (SwiftTag tag in this.ListTags((SwiftElement) sequence))
        this.RemoveTag(tag);
    }

    internal override SwiftMessageDefinition MsgDefinition()
    {
      return MT526.MessageDefinition;
    }

    protected override void InitSwiftMessageDefinition()
    {
      MT526.MessageDefinition = new SwiftMessageDefinition("MT526", "General Securities Lending/Borrowing Message");
      MT526.U0002 = new SwiftTagSequenceDefinition("SequenceA", "Sequence A");
      MT526.U0003 = new SwiftTagDefinition("TransactionReferenceNumber_A_20", "Transaction Reference Number");
      MT526.U0003.TagName = ":20:";
      MT526.U0004 = new SwiftTagSubItemDefinition("Reference", "Reference");
      MT526.U0003.Elements.Add((SwiftDefinitionElement) MT526.U0004);
      MT526.U0002.Elements.Add((SwiftDefinitionElement) MT526.U0003);
      MT526.U0005 = new SwiftTagDefinition("RelatedReference_A_21", "Related Reference");
      MT526.U0005.TagName = ":21:";
      MT526.U0005.Mandatory = false;
      MT526.U0006 = new SwiftTagSubItemDefinition("Reference", "Reference");
      MT526.U0005.Elements.Add((SwiftDefinitionElement) MT526.U0006);
      MT526.U0002.Elements.Add((SwiftDefinitionElement) MT526.U0005);
      MT526.U0007 = new SwiftTagDefinition("FurtherIdentification_A_23", "Further Identification");
      MT526.U0007.TagName = ":23:";
      MT526.U0008 = new SwiftTagSubItemDefinition("Function", "Function");
      MT526.U0007.Elements.Add((SwiftDefinitionElement) MT526.U0008);
      MT526.U000E = new SwiftTagSubItemDefinition("Code", "Code");
      MT526.U000E.Mandatory = false;
      MT526.U0007.Elements.Add((SwiftDefinitionElement) MT526.U000E);
      MT526.U0002.Elements.Add((SwiftDefinitionElement) MT526.U0007);
      MT526.U000F = new SwiftTagDefinition("SafekeepingAccount_A_83C", "Safekeeping Account");
      MT526.U000F.TagName = ":83C:";
      MT526.U000F.Mandatory = false;
      MT526.U0010 = new SwiftTagSubItemDefinition("Account", "Account");
      MT526.U000F.Elements.Add((SwiftDefinitionElement) MT526.U0010);
      MT526.U0002.Elements.Add((SwiftDefinitionElement) MT526.U000F);
      MT526.U0011 = new SwiftTagDefinition("From_A_29A", "From");
      MT526.U0011.TagName = ":29A:";
      MT526.U0011.Mandatory = false;
      MT526.U0002.Elements.Add((SwiftDefinitionElement) MT526.U0011);
      MT526.U0012 = new SwiftTagDefinition("ToTheAttentionOf_A_29B", "To the Attention Of");
      MT526.U0012.TagName = ":29B:";
      MT526.U0012.Mandatory = false;
      MT526.U0002.Elements.Add((SwiftDefinitionElement) MT526.U0012);
      MT526.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT526.U0002);
      MT526.U0013 = new SwiftTagSequenceDefinition("SequenceB", "Sequence B");
      MT526.U0013.Multiple = true;
      MT526.U0014 = new SwiftTagDefinition("IdentificationOfSecurities_B_35B", "Identification Of Securities");
      MT526.U0014.TagName = ":35B:";
      MT526.U0015 = new SwiftTagSubItemDefinition("IdentificationOfSecurity", "Identification of Security");
      MT526.U0015.Mandatory = false;
      MT526.U0016 = new SwiftTagSubItemDefinition("IdentificationOfSecurity_1", "Identification of Security");
      MT526.U0015.Elements.Add((SwiftDefinitionElement) MT526.U0016);
      MT526.U0014.Elements.Add((SwiftDefinitionElement) MT526.U0015);
      MT526.U0017 = new SwiftTagSubItemDefinition("DescriptionOfSecurity", "Description Of Security");
      MT526.U0017.Mandatory = false;
      MT526.U0014.Elements.Add((SwiftDefinitionElement) MT526.U0017);
      MT526.U0013.Elements.Add((SwiftDefinitionElement) MT526.U0014);
      MT526.U0018 = new SwiftTagDefinition("QuantityOfSecurities_B_35A", "Quantity Of Securities");
      MT526.U0018.TagName = ":35A:";
      MT526.U0018.Mandatory = false;
      MT526.U0019 = new SwiftTagSubItemDefinition("Type", "Type");
      MT526.U0018.Elements.Add((SwiftDefinitionElement) MT526.U0019);
      MT526.U001A = new SwiftTagSubItemDefinition("Quantity", "Quantity");
      MT526.U0018.Elements.Add((SwiftDefinitionElement) MT526.U001A);
      MT526.U0013.Elements.Add((SwiftDefinitionElement) MT526.U0018);
      MT526.U001B = new SwiftTagDefinition("EffectiveDate_B_30", "Effective Date");
      MT526.U001B.TagName = ":30:";
      MT526.U001B.Mandatory = false;
      MT526.U001C = new SwiftTagSubItemDefinition("Date", "Date");
      MT526.U001B.Elements.Add((SwiftDefinitionElement) MT526.U001C);
      MT526.U0013.Elements.Add((SwiftDefinitionElement) MT526.U001B);
      MT526.U001D = new SwiftTagDefinition("ExpiryOptionDate_B_31F", "Expiry/Option Date");
      MT526.U001D.TagName = ":31F:";
      MT526.U001D.Mandatory = false;
      MT526.U001E = new SwiftTagSubItemDefinition("ExpiryOptionDate", "Expiry/Option Date");
      MT526.U001F = new SwiftTagSubItemDefinition("Date", "");
      MT526.U001E.Elements.Add((SwiftDefinitionElement) MT526.U001F);
      MT526.U007F = new SwiftTagSubItemDefinition("PeriodDate", "");
      MT526.U007F.Mandatory = false;
      MT526.U001E.Elements.Add((SwiftDefinitionElement) MT526.U007F);
      MT526.U001D.Elements.Add((SwiftDefinitionElement) MT526.U001E);
      MT526.U0080 = new SwiftTagSubItemDefinition("PeriodDetails", "Period Details");
      MT526.U0080.Mandatory = false;
      MT526.U001D.Elements.Add((SwiftDefinitionElement) MT526.U0080);
      MT526.U0013.Elements.Add((SwiftDefinitionElement) MT526.U001D);
      MT526.U0081 = new SwiftTagChoiceDefinition("Choice", "");
      MT526.U0081.Mandatory = false;
      MT526.U0081.Multiple = true;
      MT526.U0082 = new SwiftTagDefinition("ReceiverDelivererOfSecurities_A_87A", "Receiver/Deliverer of Securities");
      MT526.U0082.TagName = ":87A:";
      MT526.U0083 = new SwiftTagSubItemDefinition("PartyIdentifier", "Party Identifier");
      MT526.U0083.Mandatory = false;
      MT526.U0082.Elements.Add((SwiftDefinitionElement) MT526.U0083);
      MT526.U0084 = new SwiftTagSubItemDefinition("BankIdentifierCode", "Bank Identifier Code");
      MT526.U0082.Elements.Add((SwiftDefinitionElement) MT526.U0084);
      MT526.U0081.Elements.Add((SwiftDefinitionElement) MT526.U0082);
      MT526.U0086 = new SwiftTagDefinition("ReceiverDelivererOfSecurities_A_87D", "Receiver/Deliverer of Securities");
      MT526.U0086.TagName = ":87D:";
      MT526.U0087 = new SwiftTagSubItemDefinition("PartyIdentifier", "Party Identifier");
      MT526.U0087.Mandatory = false;
      MT526.U0086.Elements.Add((SwiftDefinitionElement) MT526.U0087);
      MT526.U0088 = new SwiftTagSubItemDefinition("NameAndAddress", "Name and Address");
      MT526.U0086.Elements.Add((SwiftDefinitionElement) MT526.U0088);
      MT526.U0081.Elements.Add((SwiftDefinitionElement) MT526.U0086);
      MT526.U0013.Elements.Add((SwiftDefinitionElement) MT526.U0081);
      MT526.U0089 = new SwiftTagDefinition("SenderToReceiverInformation_B_72", "Sender to Receiver Information");
      MT526.U0089.TagName = ":72:";
      MT526.U0089.Mandatory = false;
      MT526.U0013.Elements.Add((SwiftDefinitionElement) MT526.U0089);
      MT526.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT526.U0013);
    }

    public class SequenceAClass : SwiftTagSequence
    {
      internal override SwiftDefinitionElement Definition
      {
        get
        {
          return (SwiftDefinitionElement) MT526.U0002;
        }
      }

      [Description("Transaction Reference Number")]
      public Tag20 TransactionReferenceNumber_A_20
      {
        get
        {
          return new Tag20((SwiftElement) this, 0, (SwiftDefinitionElement) MT526.U0003);
        }
      }

      [Description("Transaction Reference Number")]
      public Tag20 Tag20_TransactionReferenceNumber_A
      {
        get
        {
          return this.TransactionReferenceNumber_A_20;
        }
      }

      [Description("Related Reference")]
      public Tag21 RelatedReference_A_21
      {
        get
        {
          return new Tag21((SwiftElement) this, 0, (SwiftDefinitionElement) MT526.U0005);
        }
      }

      [Description("Related Reference")]
      public Tag21 Tag21_RelatedReference_A
      {
        get
        {
          return this.RelatedReference_A_21;
        }
      }

      [Description("Further Identification")]
      public MT526.SequenceAClass.Tag23 FurtherIdentification_A_23
      {
        get
        {
          return new MT526.SequenceAClass.Tag23((SwiftElement) this, 0, (SwiftDefinitionElement) MT526.U0007);
        }
      }

      [Description("Further Identification")]
      public MT526.SequenceAClass.Tag23 Tag23_FurtherIdentification_A
      {
        get
        {
          return this.FurtherIdentification_A_23;
        }
      }

      [Description("Safekeeping Account")]
      public Tag83C SafekeepingAccount_A_83C
      {
        get
        {
          return new Tag83C((SwiftElement) this, 0, (SwiftDefinitionElement) MT526.U000F);
        }
      }

      [Description("Safekeeping Account")]
      public Tag83C Tag83C_SafekeepingAccount_A
      {
        get
        {
          return this.SafekeepingAccount_A_83C;
        }
      }

      [Description("From")]
      public Tag29A From_A_29A
      {
        get
        {
          return new Tag29A((SwiftElement) this, 0, (SwiftDefinitionElement) MT526.U0011);
        }
      }

      [Description("From")]
      public Tag29A Tag29A_From_A
      {
        get
        {
          return this.From_A_29A;
        }
      }

      [Description("To the Attention Of")]
      public Tag29B ToTheAttentionOf_A_29B
      {
        get
        {
          return new Tag29B((SwiftElement) this, 0, (SwiftDefinitionElement) MT526.U0012);
        }
      }

      [Description("To the Attention Of")]
      public Tag29B Tag29B_ToTheAttentionOf_A
      {
        get
        {
          return this.ToTheAttentionOf_A_29B;
        }
      }

      internal SequenceAClass(SwiftElement parent, int index, bool createTags)
        : base(parent, index, createTags)
      {
      }

      public class Tag23 : SwiftTagWrapper
      {
        public string Value
        {
          get
          {
            return this.GetValue();
          }
          set
          {
            this.SetValue("23", value);
          }
        }

        internal Tag23(SwiftElement parent, int index, SwiftDefinitionElement definition)
          : base(parent, index, definition)
        {
        }
      }
    }

    public class SequenceBClass : SwiftTagSequence
    {
      internal override SwiftDefinitionElement Definition
      {
        get
        {
          return (SwiftDefinitionElement) MT526.U0013;
        }
      }

      [Description("Identification Of Securities")]
      public Tag35B IdentificationOfSecurities_B_35B
      {
        get
        {
          return new Tag35B((SwiftElement) this, 0, (SwiftDefinitionElement) MT526.U0014);
        }
      }

      [Description("Identification Of Securities")]
      public Tag35B Tag35B_IdentificationOfSecurities_B
      {
        get
        {
          return this.IdentificationOfSecurities_B_35B;
        }
      }

      [Description("Quantity Of Securities")]
      public Tag35A QuantityOfSecurities_B_35A
      {
        get
        {
          return new Tag35A((SwiftElement) this, 0, (SwiftDefinitionElement) MT526.U0018);
        }
      }

      [Description("Quantity Of Securities")]
      public Tag35A Tag35A_QuantityOfSecurities_B
      {
        get
        {
          return this.QuantityOfSecurities_B_35A;
        }
      }

      [Description("Effective Date")]
      public Tag30 EffectiveDate_B_30
      {
        get
        {
          return new Tag30((SwiftElement) this, 0, (SwiftDefinitionElement) MT526.U001B);
        }
      }

      [Description("Effective Date")]
      public Tag30 Tag30_EffectiveDate_B
      {
        get
        {
          return this.EffectiveDate_B_30;
        }
      }

      [Description("Expiry/Option Date")]
      public MT526.SequenceBClass.Tag31F ExpiryOptionDate_B_31F
      {
        get
        {
          return new MT526.SequenceBClass.Tag31F((SwiftElement) this, 0, (SwiftDefinitionElement) MT526.U001D);
        }
      }

      [Description("Expiry/Option Date")]
      public MT526.SequenceBClass.Tag31F Tag31F_ExpiryOptionDate_B
      {
        get
        {
          return this.ExpiryOptionDate_B_31F;
        }
      }

      [Description("Receiver/Deliverer of Securities")]
      public Tag87A ReceiverDelivererOfSecurities_A_87A
      {
        get
        {
          return new Tag87A((SwiftElement) this, 0, (SwiftDefinitionElement) MT526.U0082);
        }
      }

      [Description("Receiver/Deliverer of Securities")]
      public Tag87A Tag87A_ReceiverDelivererOfSecurities_A
      {
        get
        {
          return this.ReceiverDelivererOfSecurities_A_87A;
        }
      }

      [Description("Receiver/Deliverer of Securities")]
      public Tag87D ReceiverDelivererOfSecurities_A_87D
      {
        get
        {
          return new Tag87D((SwiftElement) this, 0, (SwiftDefinitionElement) MT526.U0086);
        }
      }

      [Description("Receiver/Deliverer of Securities")]
      public Tag87D Tag87D_ReceiverDelivererOfSecurities_A
      {
        get
        {
          return this.ReceiverDelivererOfSecurities_A_87D;
        }
      }

      [Description("Sender to Receiver Information")]
      public Tag72 SenderToReceiverInformation_B_72
      {
        get
        {
          return new Tag72((SwiftElement) this, 0, (SwiftDefinitionElement) MT526.U0089);
        }
      }

      [Description("Sender to Receiver Information")]
      public Tag72 Tag72_SenderToReceiverInformation_B
      {
        get
        {
          return this.SenderToReceiverInformation_B_72;
        }
      }

      internal SequenceBClass(SwiftElement parent, int index, bool createTags)
        : base(parent, index, createTags)
      {
      }

      public class Tag31F : SwiftTagWrapper
      {
        public string Value
        {
          get
          {
            return this.GetValue();
          }
          set
          {
            this.SetValue("31F", value);
          }
        }

        internal Tag31F(SwiftElement parent, int index, SwiftDefinitionElement definition)
          : base(parent, index, definition)
        {
        }
      }
    }
  }
}
